package com.yaoli.ajob;

/**
 * Created by will on 2017/4/21.
 *
 * see
 *
 * https://www.youtube.com/watch?v=CFQk7OQO_xM
 */
public class _070_ClimbingStairs {
    public int climbStairs(int n) {
        if(n == 1){
            return 1;
        }else if(n == 2){
            return 2;
        }

        int dp [] = new int[n];
        dp[0] = 1;
        dp[1] = 2;
        for(int i = 2 ; i < n; i ++){
            dp [i] = dp [i - 1] + dp [i - 2];
        }

        return dp[ n - 1];
    }
}
